package com.github.kezhenxu94.playground.java.interview.netease;

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 * 平方串
 * 
 * @author KeZhenxu
 *
 */
public class NetEaseSquareString {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		Set<String> squaredSubStringSet = new HashSet<>();
		for (int len = 1; len <= str.length() / 2; len++) {
			for (int i = 0; i < str.length() - 2 * len + 1; i++) {
				boolean isSquaredString = true;
				for (int j = i, k = j + len; j < i + len; j++, k++) {
					if (str.charAt(j) != str.charAt(k)) {
						isSquaredString = false;
					}
				}
				if (isSquaredString) {
					squaredSubStringSet.add(str.substring(i, i + len));
				}
			}
		}
		System.out.println(squaredSubStringSet);
		sc.close();
	}
}
